﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ScriptManager.ascx.cs"
    Inherits="MLM.AdminCP.Controls.ScriptManager" %>
<script src="/js/hideshow.js" type="text/javascript"></script>
<script src="/js/jquery.tablesorter.min.js" type="text/javascript"></script>
<script type="text/javascript" src="/js/jquery.equalHeight.js"></script>
<script src="/AdminCP/Libs/Plugins/notify/notify.js" type="text/javascript"></script>
<script src="/AdminCP/Libs/Plugins/hightchart/highcharts.js" type="text/javascript"></script>
<script type="text/javascript">
    $(function () {
        $(".tablesorter").tablesorter();
        //When page loads...
        $(".tab_content").hide(); //Hide all content
        $("ul.tabs li:first").addClass("active").show(); //Activate first tab
        $(".tab_content:first").show(); //Show first tab content
        //On Click Event
        $("ul.tabs li").click(function () {
            $("ul.tabs li").removeClass("active"); //Remove any "active" class
            $(this).addClass("active"); //Add "active" class to selected tab
            $(".tab_content").hide(); //Hide all tab content
            var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
            $(activeTab).fadeIn(); //Fade in the active ID content
            return false;
        });
        $('#sidebar').css({ 'min-height': $(window).height() - 90 });
        $('.column').equalHeight();
    });
    //Shop Cart
    $(function () {
        var MLM = {};
        MLM.AddToCartSuccess = '<%=Resources.MLM.AddToCartSuccess %>'
        $('.CartOut').click(function () {
            var ProducID = $(this).attr('productid');
            var CountProduct = $(this).prev().find(".CountProduct").val();
            var CountryID = $(".HfCountryID").text();
            var UserID = $(".HfUserID").text();
            var DepoID = $(".HfDepoID").text();
            $.ajax({
                type: "POST",
                url: "/AdminCP/Pages/ShoppingCart.aspx/AddToCart",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                beforeSend: function () {
                    $('.loadingstate').css("display", "inline-block");
                    $('.loadingstate').html('<img src="/App_Themes/UIT/UITImages/vi-VN/loading7.gif" width="100" height="100" />');
                },
                data: "{'product':'" + ProducID + "','CountProduct':'" + CountProduct + "','CountryID':'" + CountryID + "','UserID':'" + UserID + "','DepoID':'" + DepoID + "'}",
                async: true,
                success: function (msj) {
                    if (msj.d > 0) {
                        $('.loadingstate').css("display", "none");
                        $.notify.success(MLM.AddToCartSuccess, {
                            occupySpace: true,
                            close: true,
                            autoClose: 3000
                        });
                        //$("#TotalCart").html("Giỏ hàng có <span> " + msj.d + "</span> sản phẩm");
                        $(".Total").text(msj.d);
                    }
                }
            });
            return false;
        });
    });
    //End Shop Cart
    function MLMShowSuccessMessage(content) {
        $.notify.success(content, {
            autoClose: 3000,
            close: true
        });
    }
    function MLMShowErrorMessage(content) {
        $.notify.error(content, {
            autoClose: 3000,
            close: true
        });
    }
    function MLMShowAlertMessage(content) {
        $.notify.alert(content, {
            autoClose: 3000,
            close: true
        });
    }
    function MLMShowNormalMessage(content) {
        $.notify.basic(content, {
            autoClose: 3000,
            close: true
        });
    }
</script>
